import { request } from "@/utils/service"
import type * as Banners from "./types"

/** 增 */
export function createBannersApi(data: Banners.CreateOrUpdateBannersRequestData) {
  return request({
    url: "banners",
    method: "post",
    data
  })
}

/** 删 */
export function deleteBannersApi(id: string) {
  return request({
    url: `banners/${id}`,
    method: "delete"
  })
}

/** 改 */
export function updateBannersApi(data: Banners.CreateOrUpdateBannersRequestData) {
  return request({
    url: "banners/" + data.id,
    method: "put",
    data
  })
}

/** 查 */
export function getBannersApi(params: Banners.GetBannersRequestData) {
  return request<Banners.GetBannersResponseData>({
    url: "banners",
    method: "get",
    params
  })
}

/** 查详情 */
export function getBannersDetailApi(id: string) {
  return request<Banners.GetNewResponeseDetailData>({
    url: `banners/${id}`,
    method: "get"
  })
}
